// 封装对history的三个操作（存储，删除，获取）

// 消除魔法字符串
const HISTORY = 'search-history'

// 存储
export const saveHistory = (historyObj) => {
  localStorage.setItem(HISTORY, JSON.stringify(historyObj))
}

// 获取
export const getHistory = () => {
  return JSON.parse(localStorage.getItem(HISTORY))
}

// 删除
export const delHistory = () => {
  localStorage.removeItem(HISTORY)
}
